package com.scujcc.springtask;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class MySchedule2 {

    //启动一个定时任务是启动了一个新的线程，每隔三秒执行一次
    @Scheduled(cron = "0/3 * * * * *")
    public void print2(){
        System.out.println(Thread.currentThread().getName() + "定时任务2执行中...");

    }
}
